< previous page page_441 next page >

Page 441
Of course, you also need to take away the value <Required> when the user gives the text box focus. You can do this in the GotFocus() event of each of the text boxes. Write the GotFocus() event for each text box like this:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub txtFirst_GotFocus()
   If txtFirst.Text = conRequired Then
      txtFirst.Text = ""
      txtFirst.Font.Italic = False
   End If
End Sub
If the user is tabbing into a text box with the <Required> text set, you just need to erase the text and reset the italic font to False so when the user types data in, it will be in a normal font.
The Printer Collection
The Printer collection returns to you all the available printers connected to your computer. You can loop through this collection, just like any other collection, by using the For Each...Next statement:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub cmdCol2_Click()
   Dim sMsg As String
   Dim prt As Printer

   For Each prt In Printers
      sMsg = sMsg & "Port   = " & prt.Port & _
                    vbCrLf & _
                    "Device = " & prt.DeviceName & _
                    vbCrLf
   Next prt

   MsgBox sMsg
End Sub
Each time through the Printers collection, you receive a Printer object. You can then access the properties of this Printer object and grab the Port and DeviceName properties, which allow you to see the port and the name of the printer connected to the system. These are just a few of the properties available for the Printer object.

 
< previous page page_441 next page >

If you like this book, buy it!